<#include "macro/include.ftl"/>
<#import "spring.ftl" as spring />
<html>
	<head>
		<title>牛牛妞妞 | 互助 | 创建帮助</title>		
	</head>
	<body>
		<script type="text/javascript">
			var cost = ${createFavorForm.cost};
			var category = ${createFavorForm.category};
			Event.onDOMReady(function(){
				var radio_cost = $("cost_" + cost);
				var select_category = $("category_" + category);
				if(radio_cost){
					radio_cost.checked = true;
				}
				if(select_category){
					select_category.selected = true;
				}
			});
		</script>
		<div class="main_module">
			<input id="navtype" type="hidden" value="favor"/>
			<form id="createFavorForm" method="post" action="${rc.contextPath}/favor/create.og">
				<input type="hidden" name="submitType" value="createFavorForm"/>
				<h2>创建互助信息</h2>
				<p>
					<@spring.bind "createFavorForm.*" />
					<@error.field errorList=spring.status.errorMessages/>
				</p>	
				<fieldset>
					<@spring.bind "createFavorForm.title" />
					<#assign expr=spring.status.expression> 
					<label for="${expr}">
						<span>标题:<@form.asterisk/></span>
						<span class="last">
							<input id="${expr}" class="text" style="width:300px;height:20px;" name="${expr}" 
							value="${spring.status.value!}" type="text"/>
						</span>
					</label>
					<@spring.bind "createFavorForm.content" />
					<#assign expr=spring.status.expression> 
					<label for="${expr}" class="last">
						<span>内容:<@form.asterisk/></span>
						<span class="last">
						<textarea id="${expr}" name="${expr}" style="width:300px;height:100px;">${spring.status.value!}</textarea>
						</span>
					</label>
					<@spring.bind "createFavorForm.cost" />
					<#assign expr=spring.status.expression> 
					<label class="last">
						<span>代价:<@form.asterisk/></span>
						<span class="last">
							<table style="">
							<#list createFavorForm.costs?chunk(2) as row>
							<tr>
							<#list row as cs>
									<td style="width:90px;">
										<label for="cost_${cs.id}"><input id="cost_${cs.id}" name="${expr}" value="${cs.id}" type="radio"/>${cs.name}</label>
									</td>
							</#list>
							</tr>
							</#list>
							</table>
						</span>
					</label>
					<@spring.bind "createFavorForm.category" />
					<#assign expr=spring.status.expression> 				
					<label class="last">
						<span>类别:<@form.asterisk/></span>
						<span class="last">
							<table>
								<tr>
									<td>
										<select name="category">
										<#list createFavorForm.categories as cg>
											<option id="category_${cg.id}" value="${cg.id}">${cg.name}</option>
										</#list>
										</select>
									</td>
								</tr>																										
							</table>
						</span>
					</label>				
				</fieldset>			
				<#-- <fieldset>
					<@spring.bind "createFavorForm.tags" />
					<#assign expr=spring.status.expression> 			
					<label for="${expr}}" class="last">
						<@error.field errorList=spring.status.errorMessages/>				
						<span>标签:</span>
						<span class="last">
							<input id="${expr}" class="tag" name="${expr}" 
							value="${spring.status.value!}" type="text"/>
							<br/><strong>用一组空格间隔开的词语来形容帮助内容，最多可以用20个词语<br/>如：电脑 硬盘 出售</strong>
						</span>					
					</label>
				</fieldset> -->
						
				<fieldset class="submit">
					<input class="submit" type="submit" value="保存" />
					<input class="submit" type="submit" value="保存后继续创建" />
				</fieldset>			
			</form>
		</div>
	</body>
</html>